<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>RPG入门 | 樱桃小窝</title><meta name="keywords" content="AS/400"><meta name="author" content="樱桃先生"><meta name="copyright" content="樱桃先生"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="RPGPG 的全称：Report Program GeneratorIBM 的 AS&#x2F;400 小型机上的高级语言.REPORT PROGRAM GENERATOR,程序运行效率很高.RPG 起始是一个非常简单的面向事务处理的编程语言, 用被储存在系统 IBM709 和 360 型号的 20 针打孔卡中的数据而生成报表.系统 3 由于它的硬式磁盘而带来了 RPG 2, 使它变成中型的 IBM 机器的">
<meta property="og:type" content="article">
<meta property="og:title" content="RPG入门">
<meta property="og:url" content="http://example.com/posts/6b2345a3/index.html">
<meta property="og:site_name" content="樱桃小窝">
<meta property="og:description" content="RPGPG 的全称：Report Program GeneratorIBM 的 AS&#x2F;400 小型机上的高级语言.REPORT PROGRAM GENERATOR,程序运行效率很高.RPG 起始是一个非常简单的面向事务处理的编程语言, 用被储存在系统 IBM709 和 360 型号的 20 针打孔卡中的数据而生成报表.系统 3 由于它的硬式磁盘而带来了 RPG 2, 使它变成中型的 IBM 机器的">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg">
<meta property="article:published_time" content="2020-09-24T14:41:00.000Z">
<meta property="article:modified_time" content="2022-08-27T09:38:15.879Z">
<meta property="article:author" content="樱桃先生">
<meta property="article:tag" content="AS&#x2F;400">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://example.com/posts/6b2345a3/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'RPG入门',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2022-08-27 17:38:15'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.4.2"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="https://s2.loli.net/2022/08/20/hk9Zvq4YRsIcnrw.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">78</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">65</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">21</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间线</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/gallery/"><i class="fa-fw fas fa-camera"></i><span> 图库</span></a></div><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fas fa-comment-dots"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/links/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">樱桃小窝</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间线</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/gallery/"><i class="fa-fw fas fa-camera"></i><span> 图库</span></a></div><div class="menus_item"><a class="site-page" href="/messageboard/"><i class="fa-fw fas fa-comment-dots"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/links/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">RPG入门</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-09-24T14:41:00.000Z" title="发表于 2020-09-24 22:41:00">2020-09-24</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2022-08-27T09:38:15.879Z" title="更新于 2022-08-27 17:38:15">2022-08-27</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E6%8A%80%E6%9C%AF/">技术</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E6%8A%80%E6%9C%AF/AS-400/">AS/400</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="RPG入门"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="RPG"><a href="#RPG" class="headerlink" title="RPG"></a>RPG</h1><p>PG 的全称：<strong>Report Program Generator</strong><br>IBM 的 AS/400 小型机上的高级语言.REPORT PROGRAM GENERATOR,程序运行效率很高.RPG 起始是一个非常简单的面向事务处理的编程语言, 用被储存在系统 IBM709 和 360 型号的 20 针打孔卡中的数据而生成报表.系统 3 由于它的硬式磁盘而带来了 RPG 2, 使它变成中型的 IBM 机器的标准应用程序语言  </p>
<h2 id="HelloWorld"><a href="#HelloWorld" class="headerlink" title="HelloWorld"></a>HelloWorld</h2><p>使用132位</p>
<p>类型选择RPGLE</p>
<p>首行输入C   按F4</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">*************** Beginning of data *******************</span><br><span class="line">C     &#x27;HELLO&#x27;       DSPLY                            </span><br><span class="line">C     &#x27;WORLD!&#x27;      DSPLY                            </span><br><span class="line">C                   RETURN                           </span><br><span class="line">****************** End of data **********************</span><br></pre></td></tr></table></figure>

<p>完成之后使用 </p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">CALL 文件名</span><br></pre></td></tr></table></figure>

<h2 id="程序结束"><a href="#程序结束" class="headerlink" title="程序结束"></a>程序结束</h2><p><img src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/image-20200927195612414.png" alt="image-20200927195612414"></p>
<h2 id="入口参数"><a href="#入口参数" class="headerlink" title="入口参数"></a>入口参数</h2><p>程序可以通过<code>*ENTRY</code>定义入口参数，或称之为接口参数，来传递数据。<br>假设有程序FHS01ILE，其中入口参数的定义如下：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">C *ENTRY PLIST</span><br><span class="line">C PARM   FLD01 3</span><br><span class="line">C PARM   FLD02 4</span><br></pre></td></tr></table></figure>
<p>其中：<br>*ENTRY 在“Factor 1”项；<br>PLIST     在“Operation”项；<br>PARM    在“Operation”项；<br>FLD01、FLD02 都在“Result”项上述定义，表示这个程序通过两个字段与其它外部程序沟通。<br>那么别的程序(如FHS02ILE)在调用程序FHS01ILE 时，就要带上两个字符型变量，如</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">C CALL ‘FHS01ILE’</span><br><span class="line">C PARM FHSFLD01 3</span><br><span class="line">C PARM FHSFLD02 4</span><br></pre></td></tr></table></figure>
<p>在两个程序里，这两个变量名可以不同（比如说一边叫FHSFLD01，FHSFLD02；一边叫FLD01，<br>FLD02），但<strong>长度</strong>，<strong>类型</strong>必须匹配</p>
<p><strong>入口参数的定义，可以写在程序的任何一处，而程序的执行，始终是从C 行的顺序第一行开始</strong><br><strong>执行，与入口参数所在的位置无关</strong>  </p>
<h2 id="D行说明"><a href="#D行说明" class="headerlink" title="D行说明"></a>D行说明</h2><ul>
<li><p><strong>Name:</strong></p>
<p>定义的变量名字 可以不顶格写</p>
</li>
<li><p><strong>E</strong></p>
<p>如果是程序内部自行定义一个临时变量 此处不填</p>
<p>如果是引用一个外部文件作为数据结构 填 E ;同时“Declaration Type”处，就要填“DS”，即定义为一个结构；“Keywords”处要使用EXTNAME 关键字  </p>
<p><img src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/image-20200924134719303.png" alt="image-20200924134719303"></p>
</li>
</ul>
<ul>
<li><p><strong>S/U</strong></p>
<p>一般都填空</p>
</li>
<li><p><strong>Declaration Type</strong></p>
<p>定义变量的类型,允许的值如下:</p>
<p>DS: 数据结构</p>
<p>C: 常量 常量只能使用字符 不需要定义常量的长度 类型</p>
<pre><code>         常量的内容写在 keywords处 并使用const关键字 在程序段中 不能对常量赋值
</code></pre>
<p>S: 定义以下内容 独立变量 数组 表</p>
</li>
<li><p><strong>From</strong></p>
<p>当 “Declaration Type” 项为 S , DS 此项不填 </p>
<p>当 “Declaration Type” 项为空 表示当前定义的变量 属于上面定义的结构 此时可以填写也可以不填写</p>
<p>当填写时，“From”项表示变量在结构中的起始位置，右对齐；“To/length”表示变量在结构<br>中的结束位置，也是右对齐。<br>当不填写时，“To/length”表示直接定义为变量长度。  </p>
</li>
<li><p><strong>Internal Data Type</strong>  </p>
<p>A： 变量定义为字符型</p>
<p>B： 二进制</p>
<p>D： 变量定义为日期型</p>
<p>F： 变量定义为浮点型</p>
<p>G： 变量定义为图型（非英文,汉字）</p>
<p>I： 变量定义为带符号的整数</p>
<p>N： 变量定义为指示器变量（没用过）</p>
<p>P： 变量定义为压缩型数字</p>
<p>S： 变量定义为普通的数型</p>
<p>T： 变量定义为时间型</p>
<p>U： 变量定义为无符号的整数</p>
<p>Z： 变量定义为日期+时间型（格式：年-月-日-时.分.秒.微秒）</p>
<p>*： 变量定义为指针型 </p>
</li>
<li><p><strong>Keywords</strong>  </p>
<p>CONST： 定义常量的值<br>DIM： 定义数组<br>EXTNAME：引用外部文件作为数据结构变量<br>EXTFLD： 对引用了外部文件作为数据结构的某个变量，进行重命名<br>LIKE： 定义变量时，参照已存在的变量定义<br>OCCURS： 定义结构体变量时，指定的结构体变量的记录条数<br>INZ： 定义变量时，赋值初始值<br>DATFMT： 定义日期变量时，指定日期格式<br>*MDY (mm/dd/yy)<br>*DMY (dd/mm/yy)<br>*YMD (yy/mm/dd)<br>*JUL (yy/ddd)<br>*ISO (yyyy-mm-dd)<br>*USA (mm/dd/yyyy)<br>*EUR (dd.mm.yyyy)</p>
</li>
</ul>
<blockquote>
<p>补充说明  :</p>
<p>变量的定义，除了在D 行定义之外，还可以在C 行通过赋值语句直接定义<br>如<br>D FLD01 S 2 INZ(‘01’)<br>与<br>C MOVE ‘01’ FLD01 2 //2 在length 处，右对齐<br>是等价的</p>
</blockquote>
<h2 id="C行说明"><a href="#C行说明" class="headerlink" title="C行说明"></a>C行说明</h2><h3 id="Level"><a href="#Level" class="headerlink" title="Level"></a>Level</h3><p>一般不填</p>
<h3 id="N01"><a href="#N01" class="headerlink" title="N01"></a>N01</h3><p>这个含义比较丰富，我只用过其中一种：<br>首位不带N，后面填写01—99 的数字时，表示相应的指示器打开时，执行后面的操作，<br>如：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">C 12 EVAL FHS01=’01’</span><br></pre></td></tr></table></figure>
<p>等价于</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">IF *IN12=’1’</span><br><span class="line">EVAL FHS01=’01’</span><br><span class="line">ENDIF  </span><br></pre></td></tr></table></figure>
<p>首位带N，后面填写01—99 的数字，表示相应的指示器关闭时，执行后面的操作<br>要注意，该项内容仅作用于该行操作码。如果指示器打开后，需要执行多条语句，那么每条语<br>句前面，该项都要赋值  </p>
<p>所以说，根据指示器状态来执行的语句，在执行少量操作码时，可以使用这种方法；如果语句<br>较多，修改起来不方便，还是直接用IF—ENDIF 的判断语句比较合适  </p>
<h3 id="Factor-1"><a href="#Factor-1" class="headerlink" title="Factor 1"></a>Factor 1</h3><p>操作内容一，将在后面与操作码一起讲</p>
<h3 id="Operation"><a href="#Operation" class="headerlink" title="Operation"></a>Operation</h3><p>操作码，后面有专门章节讲解操作码</p>
<h3 id="Factor-2"><a href="#Factor-2" class="headerlink" title="Factor 2"></a>Factor 2</h3><p>操作内容二，同上</p>
<h3 id="Result"><a href="#Result" class="headerlink" title="Result"></a>Result</h3><p>操作结果，同上</p>
<h3 id="Length"><a href="#Length" class="headerlink" title="Length"></a>Length</h3><p>长度。  </p>
<h3 id="Decimal-Positions"><a href="#Decimal-Positions" class="headerlink" title="Decimal Positions"></a>Decimal Positions</h3><p>与length 相呼应，当此项有值时，表示定义的是一个数字型变量，该项表示小数位长度。  </p>
<h3 id="HI、LO、EQ"><a href="#HI、LO、EQ" class="headerlink" title="HI、LO、EQ"></a>HI、LO、EQ</h3><p>这是三个指示器位置项。可赋值的内容是从01—99，  </p>
<h2 id="操作码汇总"><a href="#操作码汇总" class="headerlink" title="操作码汇总"></a>操作码汇总</h2><p>ILE 操作码分类：</p>
<ol>
<li><p><strong>程序流程控制</strong><br> DO、DOU、DOUxx、DOW、DOWxx、ITER、LEVAE<br> IF、ELSE、ELSEIF、IFxx、ORxx、ANDxx<br> SELECT、WHEN、WHENxx、OTHER、ENDxx、GOTO、TAG 、EXSR、BEGSR、ENDSR<br> CABxx</p>
</li>
<li><p><strong>初始化操作</strong><br> CLEAR、RESET</p>
</li>
<li><p><strong>文件操作</strong><br> OPEN、CLOSE、<br> CHAIN、SETGT、SETLL、READ、READC、READE、READP、READPE、DELETE、UPDATE、WRITE 、<br> UNLOCK<br> ROLBK、COMMIT、EXFMT、ACQ、EXCEPT、FEOD、FORCE、NEXT、POST、REL</p>
</li>
<li><p><strong>程序调用</strong><br> CALL、CALLB、CALLP、PARM、PLIST、RETURN</p>
</li>
<li><p><strong>赋值语句</strong><br> MOVE、MOVEA、MOVEL、EVAL</p>
</li>
<li><p><strong>字符操作</strong><br> CAT、CHECK、CHECKR、SCAN、SUBST、XLATE</p>
</li>
<li><p><strong>数字操作</strong><br> ADD、DIV（除）、MULT（乘）、MVR（除法取余）、SQRT（开方）、SUB、XFOOT、<br> Z-ADD、Z-SUB</p>
</li>
<li><p><strong>数组操作符</strong><br> LOOKUP、MOVEA、SORTA、XFOOT</p>
</li>
<li><p><strong>数据区操作(没用过)</strong><br> IN、OUT、UNLOCK</p>
</li>
<li><p><strong>日期操作</strong><br>ADDDUR、EXTRCT、SUBDUR、TEST</p>
</li>
<li><p><strong>指示器操作</strong><br>SETOFF、SETON</p>
</li>
<li><p><strong>信息操作（前两个没用过）</strong><br>DUMP、SHTDN、TIME、DSPLY</p>
</li>
<li><p><strong>内存管理操作(完全没用过 )</strong></p>
<p>ALLOC、DEALLOC、REALLOC</p>
</li>
<li><p><strong>位操作（没用过）</strong><br>BITOFF、BITON、TESTB  </p>
</li>
</ol>
<h2 id="第二种编译方式"><a href="#第二种编译方式" class="headerlink" title="第二种编译方式"></a>第二种编译方式</h2><ol>
<li><p>CRTRPGMOD F4</p>
<p><img src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/image-20200924223558082.png" alt="image-20200924223558082"></p>
</li>
<li><p>CRTPGM F4</p>
<p><img src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/image-20200924223755594.png" alt="image-20200924223755594"></p>
</li>
</ol>
<h2 id="DEBUG"><a href="#DEBUG" class="headerlink" title="DEBUG"></a>DEBUG</h2><p>在编译的时候要把<code>*source</code>打开</p>
<ol>
<li>STRDBG(输入程序名) f4 添加库名并且把 UPDPROD 项选为“*YES” </li>
<li>在合适的位置设置断点（F6）并退出（F12）</li>
<li>调用该程序（CALL 程序名，并赋对应的入口参数）</li>
<li>进入debug 模式后，可F10进行执行，F11查看字段的值（光标要定位到字段处），F6可以任意位置设置断点，F12退出debug模式。</li>
<li>退出debug模式后，输入 ENDDBG 命令。</li>
</ol>
<h2 id="如果File被锁"><a href="#如果File被锁" class="headerlink" title="如果File被锁"></a>如果File被锁</h2><p>WRKOBJLCK</p>
<p>指定文件 填*FILE </p>
<h2 id="错误代码原因查询"><a href="#错误代码原因查询" class="headerlink" title="错误代码原因查询"></a>错误代码原因查询</h2><p>WRKMSGD CPF4131</p>
</article><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/AS-400/">AS/400</a></div><div class="post_share"><div class="social-share" data-image="https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg" data-sites="wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://s2.loli.net/2022/08/21/Ay5sujrkH1nLTwW.jpg" target="_blank"><img class="post-qr-code-img" src= "" data-lazy-src="https://s2.loli.net/2022/08/21/Ay5sujrkH1nLTwW.jpg" alt="Wechat"/></a><div class="post-qr-code-desc">Wechat</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/a83ba4eb/"><img class="prev-cover" src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">RPG-F行说明</div></div></a></div><div class="next-post pull-right"><a href="/posts/6b557ec5/"><img class="next-cover" src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">AS/400(二)</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/posts/b9ff8872/" title="10.21笔记"><img class="cover" src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-10-27</div><div class="title">10.21笔记</div></div></a></div><div><a href="/posts/881792ef/" title="10.22笔记"><img class="cover" src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-10-27</div><div class="title">10.22笔记</div></div></a></div><div><a href="/posts/9421881e/" title="AS&#x2F;400事务和日志"><img class="cover" src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-10-12</div><div class="title">AS&#x2F;400事务和日志</div></div></a></div><div><a href="/posts/6b557ec5/" title="AS&#x2F;400(二)"><img class="cover" src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-09-23</div><div class="title">AS&#x2F;400(二)</div></div></a></div><div><a href="/posts/6e639b06/" title="AS400(一)"><img class="cover" src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-09-22</div><div class="title">AS400(一)</div></div></a></div><div><a href="/posts/167fb41b/" title="AS&#x2F;400的历史"><img class="cover" src= "" data-lazy-src="https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-09-19</div><div class="title">AS&#x2F;400的历史</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src= "" data-lazy-src="https://s2.loli.net/2022/08/20/hk9Zvq4YRsIcnrw.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">樱桃先生</div><div class="author-info__description">樱桃先生的博客小站</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">78</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">65</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">21</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://ytblogpic.oss-cn-guangzhou.aliyuncs.com/typoraWechat.jpeg"><i class="fab fa-weixin"></i><span>加为好友</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">欢迎光临樱桃小窝🍒～评论系统日常崩溃，没有找到长期稳定好用的组件。</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#RPG"><span class="toc-number">1.</span> <span class="toc-text">RPG</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#HelloWorld"><span class="toc-number">1.1.</span> <span class="toc-text">HelloWorld</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%A8%8B%E5%BA%8F%E7%BB%93%E6%9D%9F"><span class="toc-number">1.2.</span> <span class="toc-text">程序结束</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%A5%E5%8F%A3%E5%8F%82%E6%95%B0"><span class="toc-number">1.3.</span> <span class="toc-text">入口参数</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#D%E8%A1%8C%E8%AF%B4%E6%98%8E"><span class="toc-number">1.4.</span> <span class="toc-text">D行说明</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#C%E8%A1%8C%E8%AF%B4%E6%98%8E"><span class="toc-number">1.5.</span> <span class="toc-text">C行说明</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Level"><span class="toc-number">1.5.1.</span> <span class="toc-text">Level</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#N01"><span class="toc-number">1.5.2.</span> <span class="toc-text">N01</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Factor-1"><span class="toc-number">1.5.3.</span> <span class="toc-text">Factor 1</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Operation"><span class="toc-number">1.5.4.</span> <span class="toc-text">Operation</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Factor-2"><span class="toc-number">1.5.5.</span> <span class="toc-text">Factor 2</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Result"><span class="toc-number">1.5.6.</span> <span class="toc-text">Result</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Length"><span class="toc-number">1.5.7.</span> <span class="toc-text">Length</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Decimal-Positions"><span class="toc-number">1.5.8.</span> <span class="toc-text">Decimal Positions</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#HI%E3%80%81LO%E3%80%81EQ"><span class="toc-number">1.5.9.</span> <span class="toc-text">HI、LO、EQ</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%93%8D%E4%BD%9C%E7%A0%81%E6%B1%87%E6%80%BB"><span class="toc-number">1.6.</span> <span class="toc-text">操作码汇总</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%AC%AC%E4%BA%8C%E7%A7%8D%E7%BC%96%E8%AF%91%E6%96%B9%E5%BC%8F"><span class="toc-number">1.7.</span> <span class="toc-text">第二种编译方式</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#DEBUG"><span class="toc-number">1.8.</span> <span class="toc-text">DEBUG</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%A6%82%E6%9E%9CFile%E8%A2%AB%E9%94%81"><span class="toc-number">1.9.</span> <span class="toc-text">如果File被锁</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E9%94%99%E8%AF%AF%E4%BB%A3%E7%A0%81%E5%8E%9F%E5%9B%A0%E6%9F%A5%E8%AF%A2"><span class="toc-number">1.10.</span> <span class="toc-text">错误代码原因查询</span></a></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/4995/" title="顺德好友小聚"><img src= "" data-lazy-src="https://ytblogpic.oss-cn-guangzhou.aliyuncs.com/blog-common.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="顺德好友小聚"/></a><div class="content"><a class="title" href="/posts/4995/" title="顺德好友小聚">顺德好友小聚</a><time datetime="2023-05-07T13:41:30.660Z" title="更新于 2023-05-07 21:41:30">2023-05-07</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/51438/" title="旅游归来的周末"><img src= "" data-lazy-src="https://ytblogpic.oss-cn-guangzhou.aliyuncs.com/blog-common.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="旅游归来的周末"/></a><div class="content"><a class="title" href="/posts/51438/" title="旅游归来的周末">旅游归来的周末</a><time datetime="2023-05-06T06:06:54.933Z" title="更新于 2023-05-06 14:06:54">2023-05-06</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/34851/" title="与好友的广西之旅"><img src= "" data-lazy-src="https://ytblogpic.oss-cn-guangzhou.aliyuncs.com/blog-common.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="与好友的广西之旅"/></a><div class="content"><a class="title" href="/posts/34851/" title="与好友的广西之旅">与好友的广西之旅</a><time datetime="2023-05-02T08:08:36.497Z" title="更新于 2023-05-02 16:08:36">2023-05-02</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/36794/" title="信用卡业务汇总"><img src= "" data-lazy-src="https://s2.loli.net/2022/08/22/kpfRHFaCWDTNAu1.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="信用卡业务汇总"/></a><div class="content"><a class="title" href="/posts/36794/" title="信用卡业务汇总">信用卡业务汇总</a><time datetime="2023-05-02T06:30:21.691Z" title="更新于 2023-05-02 14:30:21">2023-05-02</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/53652/" title="项目管理笔记"><img src= "" data-lazy-src="https://ytblogpic.oss-cn-guangzhou.aliyuncs.com/blog-common.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="项目管理笔记"/></a><div class="content"><a class="title" href="/posts/53652/" title="项目管理笔记">项目管理笔记</a><time datetime="2023-05-02T06:29:26.948Z" title="更新于 2023-05-02 14:29:26">2023-05-02</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://gitee.com/Xyingtao/blogimage/raw/master/img/AS400.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2023 By 樱桃先生</div><div class="footer_custom_text">一切都是最好的安排</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><div class="js-pjax"><script>(()=>{
  const init = () => {
    twikoo.init(Object.assign({
      el: '#twikoo-wrap',
      envId: 'https://twikoo-seven-fawn.vercel.app',
      region: '',
      onCommentLoaded: function () {
        btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
      }
    }, null))
  }

  const getCount = () => {
    const countELement = document.getElementById('twikoo-count')
    if(!countELement) return
    twikoo.getCommentsCount({
      envId: 'https://twikoo-seven-fawn.vercel.app',
      region: '',
      urls: [window.location.pathname],
      includeReply: false
    }).then(function (res) {
      countELement.innerText = res[0].count
    }).catch(function (err) {
      console.error(err);
    });
  }

  const runFn = () => {
    init()
    
  }

  const loadTwikoo = () => {
    if (typeof twikoo === 'object') {
      setTimeout(runFn,0)
      return
    } 
    getScript('https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js').then(runFn)
  }

  if ('Twikoo' === 'Twikoo' || !true) {
    if (true) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
    else loadTwikoo()
  } else {
    window.loadOtherComment = () => {
      loadTwikoo()
    }
  }
})()</script></div><script>window.addEventListener('load', () => {
  const changeContent = (content) => {
    if (content === '') return content

    content = content.replace(/<img.*?src="(.*?)"?[^\>]+>/ig, '[图片]') // replace image link
    content = content.replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[链接]') // replace url
    content = content.replace(/<pre><code>.*?<\/pre>/gi, '[代码]') // replace code
    content = content.replace(/<[^>]+>/g,"") // remove html tag

    if (content.length > 150) {
      content = content.substring(0,150) + '...'
    }
    return content
  }

  const getComment = () => {
    const runTwikoo = () => {
      twikoo.getRecentComments({
        envId: 'https://twikoo-seven-fawn.vercel.app',
        region: '',
        pageSize: 6,
        includeReply: true
      }).then(function (res) {
        const twikooArray = res.map(e => {
          return {
            'content': changeContent(e.comment),
            'avatar': e.avatar,
            'nick': e.nick,
            'url': e.url + '#' + e.id,
            'date': new Date(e.created).toISOString()
          }
        })

        saveToLocal.set('twikoo-newest-comments', JSON.stringify(twikooArray), 10/(60*24))
        generateHtml(twikooArray)
      }).catch(function (err) {
        const $dom = document.querySelector('#card-newest-comments .aside-list')
        $dom.innerHTML= "无法获取评论，请确认相关配置是否正确"
      })
    }

    if (typeof twikoo === 'object') {
      runTwikoo()
    } else {
      getScript('https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js').then(runTwikoo)
    }
  }

  const generateHtml = array => {
    let result = ''

    if (array.length) {
      for (let i = 0; i < array.length; i++) {
        result += '<div class=\'aside-list-item\'>'

        if (true) {
          const name = 'data-lazy-src'
          result += `<a href='${array[i].url}' class='thumbnail'><img ${name}='${array[i].avatar}' alt='${array[i].nick}'></a>`
        }
        
        result += `<div class='content'>
        <a class='comment' href='${array[i].url}' title='${array[i].content}'>${array[i].content}</a>
        <div class='name'><span>${array[i].nick} / </span><time datetime="${array[i].date}">${btf.diffDate(array[i].date, true)}</time></div>
        </div></div>`
      }
    } else {
      result += '没有评论'
    }

    let $dom = document.querySelector('#card-newest-comments .aside-list')
    $dom.innerHTML= result
    window.lazyLoadInstance && window.lazyLoadInstance.update()
    window.pjax && window.pjax.refresh($dom)
  }

  const newestCommentInit = () => {
    if (document.querySelector('#card-newest-comments .aside-list')) {
      const data = saveToLocal.get('twikoo-newest-comments')
      if (data) {
        generateHtml(JSON.parse(data))
      } else {
        getComment()
      }
    }
  }

  newestCommentInit()
  document.addEventListener('pjax:complete', newestCommentInit)
})</script><script src="/js/jquery.min.js"></script><div class="aplayer no-destroy" data-id="5225697049" data-server="netease" data-type="playlist" data-fixed="true" data-autoplay="false" data-mini="true" data-lrctype="-1"> </div><script src="https://cdn.jsdelivr.net/gh/xiabo2/CDN@latest/fishes.js"></script><link rel="stylesheet" href="/css/utils.css"><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="false" data-click="true"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/metingjs/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = ["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"]

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
  window.scrollCollect && window.removeEventListener('scroll', scrollCollect)

  typeof preloader === 'object' && preloader.initLoading()
  document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

  typeof disqusjs === 'object' && disqusjs.destroy()
})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"model":{"jsonPath":"/live2dw/assets/hijiki.model.json"},"display":{"position":"right","width":170,"height":280},"mobile":{"show":true},"log":false,"pluginJsPath":"lib/","pluginModelPath":"assets/","pluginRootPath":"live2dw/","tagMode":false});</script></body></html>